package com.example.Exercises;

public class Computer {

    public Computer(String name, String cpu, double price, double weight) {
        this.name = name;
        this.cpu = cpu;
        this.price = price;
        this.weight = weight;
    }

    public String name; //名称

    public String cpu; //型号

    public double price; //价格

    public double weight; //重量

    public void work()
    {
        System.out.println("计算机可以工作了");
    } //工作

    public int sleep(int a)
    {return a;} //睡眠

    public void game()
    {
        System.out.println("计算机可以玩游戏了");
    } //玩游戏

    public static void main(String[] args) {
        Computer c = new Computer("戴尔","i5",6666,10.0);


        System.out.println("计算机名称:"+c.name+" 型号:"+c.cpu+" 价格:"+c.price);
        c.work();
        c.game();
        System.out.println("计算机睡眠时间:"+c.sleep(32)+"小时");

    }
}
